/**
 * Created by Administrator on 2018/1/23.
 */
//禁止安卓浏览器微信调整字体大小
(function () {
    if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
        handleFontSize()
    } else {
        if (document.addEventListener) {
            document.addEventListener("WeixinJSBridgeReady", handleFontSize, false)
        } else if (document.attachEvent) {
            document.attachEvent("WeixinJSBridgeReady", handleFontSize)
            document.attachEvent("onWeixinJSBridgeReady", handleFontSize)
        }
    }
    function handleFontSize() {
        WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0})
        WeixinJSBridge.on('menu:setfont', function () {
            WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0})
        })
    }
})();

//flexible
(function (doc, win) {
    var docEl = doc.documentElement, resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            var clientWidth = docEl.clientWidth
            if (!clientWidth) return
            if (clientWidth > 540) clientWidth = 540
            docEl.style.fontSize = clientWidth / 10 + 'px'
            document.getElementsByTagName("body")[0].style.visibility = 'visible'
        }
    if (!doc.addEventListener) return
    win.addEventListener(resizeEvt, recalc, false)
    doc.addEventListener('DOMContentLoaded', recalc, false)
})(document, window)


